/**
 * 项目示例-列表表头
 * Date 2023-5-25 09:33:56
 * 可选参数可参考：https://element-plus.org/zh-CN/component/table.html#table-column-属性
 */
interface ExampleListItem {
  id: string;
  createUserId: string;
  updateTime: string;
  createTime: string;
  trainingTopic: string;
  unitId: string;
  unitName: string;
  unitNumber: string;
  trainingDate: string;
  trainingSession: string;
  peopleNumber: string;
  trainingPeople: string;
  trainingContent: string;
  trainingPeriod: string;
  trainer: string;
  trainingDuration: string;
  isAssess: string;
  trainingResult: string;
  isRecord: string;
  file: string;
  isState: string;
  reviewSuggestions: string;
}

export const mapListColumns = [
  { type: 'index', label: '序号', width: 60, align: 'center' },
  {
    prop: 'trainingTopic', label: '培训主题', width: 210, align: 'center', ellipsis: true
  },
  {
    prop: 'unitNumber', label: '单位编号', width: 210, align: 'center', ellipsis: true
  },
  {
    prop: 'unitName', label: '单位名称', width: 210, align: 'center', ellipsis: true
  },
  {
    prop: 'trainingDate', label: '培训日期', width: 210, align: 'center', ellipsis: true
  },
  {
    prop: 'isFile', label: '是否有附件', width: 130, align: 'center', ellipsis: true
  },
  {
    prop: 'isState',
    label: '审核结果',
    width: 130,
    align: 'center',
    ellipsis: true,
    formatter: function (row: any, column: any, cellValue: any) {
      if (cellValue === '0') {
        return '未审核'
      } else if (cellValue === '1') {
        return '驳回'
      } else if (cellValue === '2') {
        return '通过'
      } else {
        return '-'
      }
    }
  },
  {
    prop: 'updateTime',
    label: '更新时间',
    sortable: true,
    width: 210,
    align: 'center',
    ellipsis: true,
    formatter: function (row: any, column: any, cellValue: any) {
      if (cellValue) {
        const date = new Date(cellValue);
        const year = date.getFullYear().toString();
        const month = (date.getMonth() + 1).toString().padStart(2, '0');
        const day = date.getDate().toString().padStart(2, '0');
        const hours = date.getHours().toString().padStart(2, '0');
        const minutes = date.getMinutes().toString().padStart(2, '0');
        const seconds = date.getSeconds().toString().padStart(2, '0');
        return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
      } else {
        return '-'
      }
    }
  },
  {
    prop: 'createdTime',
    label: '创建时间',
    sortable: true,
    width: 210,
    align: 'center',
    ellipsis: true,
    formatter: function (row: any, column: any, cellValue: any) {
      if (cellValue) {
        const date = new Date(cellValue);
        const year = date.getFullYear().toString();
        const month = (date.getMonth() + 1).toString().padStart(2, '0');
        const day = date.getDate().toString().padStart(2, '0');
        const hours = date.getHours().toString().padStart(2, '0');
        const minutes = date.getMinutes().toString().padStart(2, '0');
        const seconds = date.getSeconds().toString().padStart(2, '0');
        return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
      } else {
        return '-'
      }
    }
  },
  {
    prop: 'action', label: '操作', fixed: 'right', width: 210, align: 'center'
  }
]
